// JavaScript Document
function seeload() {
    $("#ReportViewer1_AsyncWait_Wait111").show();
}
function showdate()
{
     var LanguageType="ZH-CN";
     //LanguageType = $.cookie('UICulture').toUpperCase();
     if(LanguageType== "ZH-CN")
     {
        WdatePicker({isShowWeek:true,lang:'zh-cn'});
     }
     else if(LanguageType== "EN-US")
     {
        WdatePicker({isShowWeek:true,lang:'en'});
     }
     else if(LanguageType== "ZH-HK")
     {
        WdatePicker({isShowWeek:true,lang:'zh-tw'});
     }
}
function showtime() {
    var LanguageType = "ZH-CN";
    //LanguageType = $.cookie('UICulture').toUpperCase();
    if (LanguageType == "ZH-CN") {
        WdatePicker({ isShowWeek: true, lang: 'zh-cn',dateFmt: 'yyyy-MM-dd HH:mm:ss' });
      
    }
    else if (LanguageType == "EN-US") {
        WdatePicker({ isShowWeek: true, lang: 'en',dateFmt: 'yyyy-MM-dd HH:mm:ss' });
       
    }
    else if (LanguageType == "ZH-HK") {
        WdatePicker({ isShowWeek: true, lang: 'zh-tw',dateFmt: 'yyyy-MM-dd HH:mm:ss' });
       
    }
}
function showtimemin() {
    var LanguageType = "ZH-CN";
    LanguageType = $.cookie('UICulture').toUpperCase();
    if (LanguageType == "ZH-CN") {
        WdatePicker({ isShowWeek: true, lang: 'zh-cn',dateFmt: 'yyyy-MM-dd HH:mm' });
    }
    else if (LanguageType == "EN-US") {
        WdatePicker({ isShowWeek: true, lang: 'en',dateFmt: 'yyyy-MM-dd HH:mm' });
    }
    else if (LanguageType == "ZH-HK") {
        WdatePicker({ isShowWeek: true, lang: 'zh-tw', dateFmt: 'yyyy-MM-dd HH:mm' });
    }
}

 /*右下角弹出窗口js*/
    $(document).ready(function () {
        $("#contraction").click(function () {
            $(".box-winMsg").animate({
                height: '30px', width: '30px', bottom: '0px'
            }, 1000, 'linear', function () { $(".pop_Content").hide(); });
            $("#contraction").hide();
            $("#open_window").show();
            $("#pop_title_left").hide();
        });

        $("#open_window").click(function () {
            $(".box-winMsg").animate({
                height: '237px', width: '350px', bottom: '5px'
            }, 10, 'linear', function () { $(".pop_Content").show(); });
            $("#open_window").hide();
            $("#contraction").show();
            $("#pop_title_left").show();
        });

        $("#close_window").click(function () {
            $(".box-winMsg").hide();
        });
    });
     /*右下角弹出窗口js*/
function con(msgti, msgcon, msgfun, thisid) {
    var tit = "提示信息"
    var qd1="确定";
    var qx1 = "取消";
    var LanguageType = "ZH-CN"; //$.cookie('UICulture').toUpperCase();
    if (LanguageType == "EN-US") {
        tit="Notes"
        qd1="Yes";
        qx1 = "No";
    }
    if (LanguageType == "ZH-HK") {
        tit = "提示信息"
        qd1 = "確定";
        qx1 = "取消";
    }
    jqm.confirm({
        w: 300, //提示宽度，默认200
        title: tit, //提示title
        content: msgcon, //提示内容
        ttype: 'alert',
        qd: qd1,
        qx: qx1,
        onConfirm: function () {//回调函数
            var ttt = $(msgfun).attr("id").replace(thisid, "").replace("_", "$").replace("_", "$").replace("_", "$").replace("_", "$").replace("_", "$").replace("_", "$").replace("_", "$").replace("_", "$").replace("_", "$").replace("_", "$") + thisid;
            __doPostBack(ttt, "");
            return false;
        }
    });
        }
//全局加载事件
$(function () {
	globalEvent.btnOver();
	globalEvent.eachEditor();
	globalEvent.gridRows();
	globalEvent.dateTimePicker();
	globalEvent.leftMenu();
	globalEvent.topMenu();
	globalEvent.menuSwitch();
	globalEvent.favourToggle();
	globalEvent.iframeHeight();
});

/*===============================================*/
/*加事件*/
var globalEvent = {
    /*my97 时间控件的初始化*/
    DP: function () {
        var LanguageType = $.cookie('UICulture');
        if (LanguageType == "EN-US") {
            WdatePicker({ isShowWeek: true, lang: 'en' });
        } else {
            WdatePicker({ isShowWeek: true, lang: 'zh-cn' });
        }
    },
    DPtime: function () {
        var LanguageType = $.cookie('UICulture');
        if (LanguageType == "EN-US") {
            WdatePicker({ isShowWeek: true, dateFmt: 'yyyy-MM-dd HH:mm:ss', lang: 'en' });
        } else {
            WdatePicker({ isShowWeek: true, dateFmt: 'yyyy-MM-dd HH:mm:ss', lang: 'zh-cn' });
        }
    },
    /*自适应按钮效果*/
    btnOver: function () {
        $(".btn").live('mouseover',
        function () {
            $(this).addClass("btnOver");
        }).live('mouseout',
        function () {
            $(this).removeClass("btnOver");
        });
    },
    /*inupt输入框换背景*/
    eachEditor: function () {
        $("input:text,input:password,textarea").focus(function () {
            $(this).addClass("editBgFocus");
        }).blur(function () {
            $(this).removeClass("editBgFocus");
        });
    },
    /*日期时间选择器*/
    dateTimePicker: function () {
        if ($(".dateSet").length > 0 || $(".timeSet").length > 0 || $(".YMSet").length > 0 || $(".dateTimeSet").length > 0) {
            /*日期*/
            $(".dateSet").dynDateTime().mask("9999-99-99");
            /*时间*/
            $(".timeSet").dynDateTime({
                showsTime: true,
                ifFormat: "%H:%M"
            }).mask("99:99");
            /*年月*/
            $(".YMSet").dynDateTime({
                ifFormat: "%Y-%m"
            }).mask("9999-99");
            /*日期+时间*/
            $(".dateTimeSet").dynDateTime({
                showsTime: true,
                ifFormat: "%Y-%m-%d %H:%M"
            }).mask("9999-99-99 99:99");
        }
    },
    gridRows: function () {
        $('.grid').each(function () {
            $('tbody tr:first', this).addClass("thead");
            $('tbody tr:even', this).addClass("trEven");
            $('tbody tr:odd', this).removeClass("trEven");
        });
        $('.grid tbody tr').not('tr.thead')
		.mouseover(function () {
		    $(this).addClass('trHover');
		    var n = $(this).parent().find('tr').index(this);
		    $('.fixedColsL,.fixedColsR,.scrollCon', $(this).parents('.fixedTable')).each(function () {
		        $($('.grid tbody tr', this)[n]).addClass('trHover');
		    })
		})
		.mouseleave(function () {
		    $(this).removeClass('trHover');
		    var n = $(this).parent().find('tr').index(this);
		    $('.fixedColsL,.fixedColsR,.scrollCon', $(this).parents('.fixedTable')).each(function () {
		        $($('.grid tbody tr', this)[n]).removeClass('trHover');
		    })
		});
		//$('.grid>tbody>tr').click(function () {
		$('.grid>tbody>tr').live("click",function () {
		    $(this).siblings().removeClass('trSelect'); //除掉同胞的样式。  
            //判断当前是否选中  
            var hasSelected = $(this).hasClass('trSelect');
            //如果选中，则移出selected类，否则就加上selected类  
            $(this)[hasSelected ? "removeClass" : "addClass"]('trSelect')
        });
        $('.gridBorder').each(function () {
            $('tbody tr:first', this).addClass("thead");
            $('tbody tr:even', this).addClass("trEven");
            $('tbody tr:odd', this).removeClass("trEven");
        });
        $('.gridBorder tbody tr').not('tr.thead')
		.mouseover(function () {
		    $(this).addClass('trHover');
		    var n = $(this).parent().find('tr').index(this);
		    $('.fixedColsL,.fixedColsR,.scrollCon', $(this).parents('.fixedTable')).each(function () {
		        $($('.gridBorder tbody tr', this)[n]).addClass('trHover');
		    })
		})
		.mouseleave(function () {
		    $(this).removeClass('trHover');
		    var n = $(this).parent().find('tr').index(this);
		    $('.fixedColsL,.fixedColsR,.scrollCon', $(this).parents('.fixedTable')).each(function () {
		        $($('.gridBorder tbody tr', this)[n]).removeClass('trHover');
		    })
		});
        $('.gridBorder>tbody>tr').live("click", function () {
            $(this).siblings().removeClass('trSelect'); //除掉同胞的样式。  
            //判断当前是否选中  
            var hasSelected = $(this).hasClass('trSelect');
            //如果选中，则移出selected类，否则就加上selected类  
            $(this)[hasSelected ? "removeClass" : "addClass"]('trSelect')
        });
    },
    leftMenu: function () {
        $("#mainNav a").live('click', function () {
            if ($(this).hasClass('menuItem')) {//点击一级菜单
                //alert(1)
                if ($(this).next('ul').length) {//一级菜单有二级
                    $("#mainNav ul ul").not($(this).next('ul')).slideUp();
                    $("#mainNav .current").removeClass('current');
                    $(this).toggleClass('down').next('ul').slideToggle();
                }
                else {//一级菜单无二级
                    //alert(2)
                    $("#mainNav ul ul").not($(this).next('ul')).slideUp();
                    $("#mainNav .current").removeClass('current');
                    $(this).addClass("current");
                }
            }
            else {//点击二级彩电

                $("#mainNav .current").removeClass('current');
                $(this).addClass("current");
                //alert(3)
            }
        });
        $(".menuItemList li").live('click', function () {
            $(this).addClass("listSelected").siblings().removeClass("listSelected");
        });
    },
    topMenu: function () {
        $(".topNav a").bind('click', function () {
            $(this).addClass('current').parent().siblings().find('a').removeClass('current');
        });
        $(".menuItemList li").bind('click', function () {
            $(this).addClass("listSelected").siblings().removeClass("listSelected");
        });
    },
    menuSwitch: function () {
        if ('off' == $.cookie('TS')) $('body').addClass('off');
        $("#switch").bind('click', function () {
            var sta = $.cookie('TS');
            if ('off' == sta) {
                $("#mainNav").animate({
                    left: "0"
                }, { complete: function () {
                    $('body').removeClass('off');
                }, duration: 600
                });
                if ($.browser.msie)
                    $("body").animate({
                        "background-position-x": "0px"
                    }, { duration: 600 });
                else
                    $("body").animate({
                        "background-position": "0px 0"
                    }, { duration: 600 });
                $("#switch").animate({
                    left: "119px"
                }, { duration: 600 });
                $("#content").animate({
                    'margin-left': "125px"
                }, { duration: 600 });
                $.cookie('TS', 'on', {
                    path: '/',
                    expires: 1//,
                    //domain: 'itfe.org'
                }); //保存树状态
            }
            else {
                $("#mainNav").animate({
                    left: "-119px"
                }, { complete: function () {
                    $('body').addClass('off');
                }, duration: 600
                });
                if ($.browser.msie)
                    $("body").animate({
                        "background-position-x": "-119px"
                    }, { duration: 600 });
                else
                    $("body").animate({
                        "background-position": "-119px 0"
                    }, { duration: 600 });
                $("#switch").animate({
                    left: "1px"
                }, { duration: 600 });
                $("#content").animate({
                    'margin-left': "6px"
                }, { duration: 600 });
                $.cookie('TS', 'off', {
                    path: '/',
                    expires: 1//,
                    //domain: 'itfe.org'
                }); //保存树状态
            }
        });
    },
    favourToggle: function () {
        if ('on' == $.cookie('FS')) $('#favour').removeClass('off');
        $('#favour h2').bind('click', function () {
            var favSta = $.cookie('FS');
            if ('on' == favSta) {//FS为on
                $('#favour').addClass('off');
                $.cookie('FS', 'off', {
                    path: '/',
                    expires: 1//,
                    //domain: 'itfe.org'
                }); //保存树状态
            }
            else {//FS为null或off
                $('#favour').removeClass('off');
                $.cookie('FS', 'on', {
                    path: '/',
                    expires: 1//,
                    //domain: 'itfe.org'
                }); //保存树状态
            }
        });
    },
    iframeHeight: function () {
        if ($('body').hasClass('home'))
            $(window).bind('resize', function () {
                var h = $(window).height() - $('#header').height();
                $(".right_index").height(h).find('iframe').height(h);
                //alert($(window).height())
                $("#left").height(h);
            });
    }
}

   